#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main() {
    struct stat fileStat;
    int fileDescriptor;

    fileDescriptor = open("test.c", O_RDONLY);
    if (fileDescriptor < 0) {
        perror("Error opening file");
        return 1;
    }

    if (fstat(fileDescriptor, &fileStat) < 0) {
        perror("Error getting file status");
        return 1;
    }

    printf("File Size: %ld bytes\n", fileStat.st_size);
    printf("File Permissions: %o\n", fileStat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
    printf("File Owner UID: %d\n", fileStat.st_uid);

    close(fileDescriptor);
    return 0;
}

